(function () {
    'use strict';

    angular
        .module('logcenterApp')
        .service('partitionDashService',partitionDashService);

    partitionDashService.$inject=['$http','$q'];
    function partitionDashService($http,$q) {


        var queryCallservice = function (partition,beginDateTime, endDateTime,interval,code) {
            var deferred=$q.defer();
            $http.get('api/dashboard/callService?partition=' + partition
                + '&startTime='+ beginDateTime + '&endTime=' + endDateTime+'&interval='+interval+"&code="+code).then(function (resp) {
                deferred.resolve(resp.data);
            },function (error) {
                deferred.reject(error);
            });
            return deferred.promise;
        };

        var queryCommSend = function (partition,beginDateTime, endDateTime,interval,code) {
            var deferred=$q.defer();
            $http.get('api/dashboard/commSend?partition=' + partition
                + '&startTime='+ beginDateTime + '&endTime=' + endDateTime+'&interval='+interval+"&code="+code).then(function (resp) {
                deferred.resolve(resp.data);
            },function (error) {
                deferred.reject(error);
            });
            return deferred.promise;
        };


        var queryTeleSend = function (partition,beginDateTime, endDateTime,interval,code) {
            var deferred=$q.defer();
            $http.get('api/dashboard/teleSend?partition=' + partition
                + '&startTime='+ beginDateTime + '&endTime=' + endDateTime+'&interval='+interval+"&code="+code).then(function (resp) {
                deferred.resolve(resp.data);
            },function (error) {
                deferred.reject(error);
            });
            return deferred.promise;
        };
        var queryCallBatch = function (partition,beginDateTime, endDateTime,interval,code) {
            var deferred=$q.defer();
            $http.get('api/dashboard/callBatch?partition=' + partition
                + '&startTime='+ beginDateTime + '&endTime=' + endDateTime+'&interval='+interval+"&code="+code).then(function (resp) {
                deferred.resolve(resp.data);
            },function (error) {
                deferred.reject(error);
            });
            return deferred.promise;
        };
        var querycommReceive = function (partition,beginDateTime, endDateTime,interval,code) {
            var deferred=$q.defer();
            $http.get('api/dashboard/commReceive?partition=' + partition
                + '&startTime='+ beginDateTime + '&endTime=' + endDateTime+'&interval='+interval+"&code="+code).then(function (resp) {
                deferred.resolve(resp.data);
            },function (error) {
                deferred.reject(error);
            });
            return deferred.promise;
        };
        var queryTeleReceive = function (partition,beginDateTime, endDateTime,interval,code) {
            var deferred=$q.defer();
            $http.get('api/dashboard/teleReceive?partition=' + partition
                + '&startTime='+ beginDateTime + '&endTime=' + endDateTime+'&interval='+interval+"&code="+code).then(function (resp) {
                deferred.resolve(resp.data);
            },function (error) {
                deferred.reject(error);
            });
            return deferred.promise;
        };








        return {

            queryCallservice:queryCallservice,
            queryCommSend:queryCommSend,
            queryTeleSend:queryTeleSend,
            queryCallBatch:queryCallBatch,
            querycommReceive:querycommReceive,
            queryteleReceive:queryTeleReceive,

        };
    }
})();
